package com.generator.service.article.impl;

import com.generator.dao.article.ArticleDao;
import com.generator.dto.article.ArticleAuditDto;
import com.generator.dto.article.ArticleDto;
import com.generator.service.article.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Service
@Transactional
public class ArticleServiceBean implements ArticleService {

    @Autowired
    private ArticleDao articleDao;

    @Override
    public List<ArticleDto> findAllArticle() {
        return articleDao.findAllArticle();
    }

    @Override
    public ArticleDto findArticleById(int articleId) {
        return articleDao.findArticleById(articleId);
    }

    @Override
    public void updateArticle(ArticleDto articleDto) {
        articleDao.updateArticle(articleDto);
    }

    @Override
    public void delArticle(int articleId) {
        articleDao.delArticle(articleId);
    }

    @Override
    public void addArticle(ArticleDto articleDto) {
        articleDao.addArticle(articleDto);
    }

    @Override
    public List<ArticleAuditDto> auditOpinions() {
        return articleDao.auditOpinions();
    }

    @Override
    public void updateOpinion(ArticleAuditDto articleAuditDto) {
        articleDao.updateOpinion(articleAuditDto);
    }

    @Override
    public ArticleAuditDto findOpinionById(int articleId) {
        return articleDao.findOpinionById(articleId);
    }
}
